HARDCODED_PYTHON_LIB_PATH="/usr/local/lib/python@PYTHON_VERSION_MAJOR@.@PYTHON_VERSION_MINOR@"
HARDCODED_PYTHON_SITE_PATH="$HARDCODED_PYTHON_LIB_PATH/dist-packages"
LOCAL_PYTHON_SITE_PATH=`python -c "import site; print site.getsitepackages()[0]"`
if [ "$HARDCODED_PYTHON_SITE_PATH" != "$LOCAL_PYTHON_SITE_PATH" ]; then
  mv $HARDCODED_PYTHON_SITE_PATH/*btk* $LOCAL_PYTHON_SITE_PATH
  find "$HARDCODED_PYTHON_SITE_PATH" -maxdepth 0 -empty -exec rmdir {} \;
  find "$HARDCODED_PYTHON_LIB_PATH" -maxdepth 0 -empty -exec rmdir {} \;
fi
PYTHON_BTK_PATH="$LOCAL_PYTHON_SITE_PATH/btk"
if [ -d "$PYTHON_BTK_PATH" ]; then
  cd $PYTHON_BTK_PATH
  # Create symbolic links for the dynamic libBTK* libraries (if included)
  find . -name "libBTK*" | xargs -i ln -sf $PYTHON_BTK_PATH/"{}" $PYTHON_BTK_PATH/../../../"{}" 
  # Update the dynamic linker
  ldconfig
fi